<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>3341：[Ceoi2013]adriatic</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[Ceoi2013]adriatic</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[Ceoi2013]adriatic</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                [Ceoi2013]adriatic                </h1>
                <p>时间限制：40s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：256MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><p><span style="font-size: medium"><img alt="" width="917" height="227" src="../file/3341_0.jpg" /></span></p>
<p><span style="font-size: medium"><img alt="" width="920" height="382" src="../file/3341_1.jpg" /></span></p>
<p><span style="font-size: medium"><img alt="" width="914" height="240" src="../file/3341_2.jpg" /></span></p>
<p></p>
<p><span style="font-size: medium"><span style="widows: 2; text-transform: none; text-indent: 0px; display: inline !important; font: 14px/23px Helvetica, 'Microsoft Yahei', verdana; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">琪琪在大海上搜索涛涛，琪琪把大海分为2500*2500的网格，现在琪琪拥有N条小帆船，她可以在船之间移动，由于风向的原因，她只能从一条船移动到位于这条船严格左上方或严格右下方的船。对于</span><br style="widows: 2; text-transform: none; text-indent: 0px; font: 14px/23px Helvetica, 'Microsoft Yahei', verdana; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" />
<br style="widows: 2; text-transform: none; text-indent: 0px; font: 14px/23px Helvetica, 'Microsoft Yahei', verdana; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" />
<span style="widows: 2; text-transform: none; text-indent: 0px; display: inline !important; font: 14px/23px Helvetica, 'Microsoft Yahei', verdana; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">每条帆船，琪琪想要知道从这条船跳到其他各条船的最小跳转次数和。</span><br style="widows: 2; text-transform: none; text-indent: 0px; font: 14px/23px Helvetica, 'Microsoft Yahei', verdana; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" />
<br style="widows: 2; text-transform: none; text-indent: 0px; font: 14px/23px Helvetica, 'Microsoft Yahei', verdana; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" />
</span></p></p><hr/><h3>输入格式</h3><p><p class="MsoNormal" align="left" style="text-align: left; line-height: 13.5pt; margin: 7.5pt -1.5pt 0pt 0cm; mso-line-height-rule: exactly; tab-stops: 191.75pt 453.65pt; mso-layout-grid-align: none"><span style="font-size: medium"><span lang="EN-US" style="font-family: &quot;Trebuchet MS&quot;; color: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">The first line of input contains an integer <i style="mso-bidi-font-style: normal"><span style="mso-tab-count: 1">&nbsp; </span>N</i> (3 &le; <i style="mso-bidi-font-style: normal">N</i> &le; 250 000), the number of islands. The following <i style="mso-bidi-font-style: normal"><span style="mso-tab-count: 1">&nbsp; </span>N</i> lines </span></span><span lang="EN-US" style="font-family: &quot;Trebuchet MS&quot;; color: black; font-size: 10pt; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: 13pt; margin: 0cm 16.7pt 0pt 0cm; mso-line-height-rule: exactly; mso-layout-grid-align: none"><span style="font-size: medium"><span lang="EN-US" style="font-family: &quot;Trebuchet MS&quot;; color: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">contain the locations of the islands. Each location is a pair of integers between 1 and 2500 (inclusive), the row and column numbers, respectively. </span></span><span lang="EN-US" style="font-family: &quot;Trebuchet MS&quot;; color: black; font-size: 10pt; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p><br style="widows: 2; text-transform: none; text-indent: 0px; font: 14px/23px Helvetica, 'Microsoft Yahei', verdana; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" />
<span style="widows: 2; text-transform: none; text-indent: 0px; display: inline !important; font: 14px/23px Helvetica, 'Microsoft Yahei', verdana; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">第一行包含一个数N，表示帆船的个数。</span><br style="widows: 2; text-transform: none; text-indent: 0px; font: 14px/23px Helvetica, 'Microsoft Yahei', verdana; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" />
<span style="widows: 2; text-transform: none; text-indent: 0px; display: inline !important; font: 14px/23px Helvetica, 'Microsoft Yahei', verdana; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">接下来的N行，每行包含一对数(x,y)，表示帆船的位置</span></p></p><hr/><h3>输出格式</h3><p><p class="MsoNormal" align="left" style="text-align: left; line-height: 13.5pt; margin: 7.5pt -1.5pt 0pt 0cm; mso-line-height-rule: exactly; tab-stops: 123.6pt; mso-layout-grid-align: none"><span style="font-size: medium"><span lang="EN-US" style="font-family: &quot;Trebuchet MS&quot;; color: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">The output should contain <i style="mso-bidi-font-style: normal"><span style="mso-tab-count: 1">&nbsp; </span>N</i> lines. For each island, in the same order they were given in the input, output </span></span><span lang="EN-US" style="font-family: &quot;Trebuchet MS&quot;; color: black; font-size: 10pt; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align: left; line-height: 13.5pt; margin: 0cm -1.5pt 0pt 0cm; mso-line-height-rule: exactly; mso-layout-grid-align: none"><span style="font-size: medium"><span lang="EN-US" style="font-family: &quot;Trebuchet MS&quot;; color: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">the sum of sailing distances from all other islands on a single line. </span></span><span lang="EN-US" style="font-family: &quot;Trebuchet MS&quot;; color: black; font-size: 10pt; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"><o:p></o:p></span></p>
<p><br style="widows: 2; text-transform: none; text-indent: 0px; font: 14px/23px Helvetica, 'Microsoft Yahei', verdana; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" />
<span style="widows: 2; text-transform: none; text-indent: 0px; display: inline !important; font: 14px/23px Helvetica, 'Microsoft Yahei', verdana; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">输出需要包含N行，表示琪琪想要知道的答案。</span></p></p><hr/><h3>样例输入</h3><pre>7 
1  7
7  5
4  5
4  8
6  6
6  1
2  3
</pre><hr/><h3>样例输出</h3><pre>16 
11 
12 
11 
12 
16 
8 
</pre><hr/><h3>提示</h3><p>没有写明提示</p><hr/><h3>题目来源</h3><p>没有写明来源</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=3341" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=3341" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>